//
//  NSArray+KBJSONSerializing.m
//  ZhuShou
//
//  Created by Dejun Liu on 15/10/2.
//  Copyright (c) 2015年 jw. All rights reserved.
//

#import "NSArray+KBJSONSerializing.h"

@implementation NSArray (KBJSONSerializing)

- (NSString*)KBJSONString

{
    
    NSError* error = nil;
    
    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
                        
                                                       options:NSJSONWritingPrettyPrinted
                        
                                                         error:&error];
    
    
    
    if (error != nil) {
        
        NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
        
        return nil;
        
    } else {
        
        return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
        
    }
    
}

@end
